use std::env;
use std::io::Write;

fn main() {

    let args: Vec<String> = env::args().collect();

    let mut file = std::fs::File::create("nomber.txt").expect("Error");

    let ray = ["0000", "1111", "2222", "3333", "4444", "5555", "6666", "7777", "8888", "9999"];
    
    let mut counter: f64 = 0.0000001;

    println!("Just a minute...");
    
    while counter < 1.0 {
        counter += 0.0000001;
        let num = format!("{:.7}", counter);
        let num = &num[2..];
        
        let mut phones = String::new();

        if (0..ray.len()).all(|d| !num.contains(ray[d])) {
            for arg in &args[1..] {
                let num = if arg.chars().count() == 5 { &num[..6] } else { &num };
                phones = format!("{}{}{}\n", phones, arg, num);
            }

        file.write_all(phones.as_bytes()).expect("Error");
        }
    }
}
